package com.edie.customview.data.net;

import com.edie.customview.data.net.entity.HttpResponse;

import io.reactivex.Observable;
import io.reactivex.ObservableSource;
import io.reactivex.ObservableTransformer;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;

/**
 * edie create on 2018/8/15
 */
public class HttpObservableTransformer<T> implements ObservableTransformer<HttpResponse<T>, T> {
    @Override
    public ObservableSource<T> apply(Observable<HttpResponse<T>> upstream) {
        return upstream.map(new HttpFunction<>())
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread());
    }
}
